using System;
using System.Collections.Generic;
using System.Text;

namespace Ruction
{
    internal class ChatHandler : MarshalByRefObject
	{
        internal void BroadcastThreaded(object data)
		{
			Broadcast( ( ( ChatMessageData ) data ) );
		}

        internal void Broadcast(ChatMessageData data)
		{
			this.OnChatMessageRecieved( data.Sender, data.Message );
		}

        internal delegate void ChatMessage(string sender, string message);
        internal event ChatMessage ChatMessageRecieved;

        internal void OnChatMessageRecieved(string sender, string message)
		{
			if ( this.ChatMessageRecieved != null )
			{
				this.ChatMessageRecieved( sender, message + Environment.NewLine );
			}
		}
	}
}
